//
//  View+Extension.swift
//  TanTan
//
//  Created by 于航 on 2024/9/16.
//

import SwiftUI

extension View {
    @ViewBuilder
    func `if`<Transform : View>(_ condition: Bool, transform: (Self) -> Transform) -> some View {
        if condition {
            transform(self)
        } else {
            self
        }
    }
    
    func endEditing(_ force: Bool) {
        UIApplication.shared.windows.forEach {
            $0.endEditing(force)
        }
    }
}
